import launch
import launch_ros
from os import path
from ament_index_python.packages import get_package_share_directory
from launch.launch_description_sources import PythonLaunchDescriptionSource

def generate_launch_description():
    #获取默认路径
    autopatrol_wrobot_dir = get_package_share_directory("autopatrol_wrobot")
    patrol_config_path = path.join(autopatrol_wrobot_dir,"config","patrol_config.yaml")

    action_node_turtle_control = launch_ros.actions.Node(
        package = "autopatrol_wrobot",
        executable = "patrol_node",
        parameters = [patrol_config_path])
    action_node_patrol_client = launch_ros.actions.Node(
        package = "autopatrol_wrobot",
        executable = "speaker"
    )
    
    return launch.LaunchDescription([
        action_node_patrol_client,
        action_node_turtle_control
    ])